#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int a = 0;
	int b = 0;
	int i = 4;
	scanf("%d", &a);
	int sum = 0;
	sum = a;
	b = a;
	while (i)
	{
		a = b + a * 10;
		sum += a;
		i--;
	}
	printf("%d", sum);
	return 0;
}